<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>港口费用管理</title>
		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		
		<!-- 文本框 -->
<link rel="stylesheet" href="static/ace/css/riverboat.css" />
		<script type="text/javascript" src="static/js/jquery-1.7.2.js" />
		<!--提示框-->
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	<!-- jsp文件头和头部 -->
<%@ include file="../../../system/index/top.jsp"%>
</head>
<body class="no-skin">
<div class="main-container" id="main-container"style="overflow-x:scroll">
	<div class="main-content">
		<div class="main-content-inner">
			<div class="page-content">
				<div class="row">
					<div class="col-xs-12">
						<form action="routeAttchFee/list" method="post" name="internalFeeManage" id="internalFeeManage">
						<fieldset>
 								<table style="margin-top:5px;"class="tab2">
 									<tr ><td colspan="2" class="tit2">港口费用管理</td></tr>
 									<tr>
 										<td><span class="span10">结算单位</span></td>
										<td><input type="text" name="SETTLE_UNIT" id="SETTLE_UNIT"  maxlength="32" /></td>
										<td><span class="span10">是否可用：</span></td>
										<td>
											<select name="ENABLE">
											<option value="">请选择</option>
											  <option value="1">是</option>
											  <option value="0">否</option>
											</select>
										</td>
 									</tr>
 									<tr>
 										<td><span class="span10">箱型：</span></td>
										<td><input type="text" name="BOX_TYPE" id="BOX_TYPE"  maxlength="32" /></td>
										<td><span class="span10">运输条款：</span></td> 
										<td>
											<select name="TRANSPORT_CLAUSE">
											<option value="">请选择</option>
											  <option>CY</option>
											  <option>FO</option>
											  <option>FI</option>
											</select>
										</td>
 									</tr>
 									<tr>
 									<td><span class="span10">港口名称：</span></td>
										<td><input type="text" name="PROT_NAME" id="PROT_NAME"  maxlength="32" /></td>
 										<td><span class="span10">空重标志：</span></td> 
										<td>
											<select name="EMPTY_SIGN">
											<option value="">请选择</option>
											  <option>空箱</option>
											  <option>重箱</option>
											</select>
										</td>
										
 									</tr>
 									<tr>
 										<td><span class="span10">费用名称：</span></td>
										<td><input type="text" name="FEE_NAME" id="FEE_NAME" maxlength="32" /></td>
										<td><span class="span10">贸易类别：</span></td> 
										<td>
											<select name="TRADE_TYPE">
											<option value="">请选择</option>
											  <option>内贸</option>
											  <option>外贸</option>
											</select>
										</td>
 									</tr>
 									<tr>
										
										<td><span class="span10">单价：</span></td>
										<td><input type="text" name="UNIT_PRICE" id="UNIT_PRICE"  maxlength="32" /></td>
										<td><span class="span10">货物种类：</span></td> 
										<td>
											<select name="GOODS_TYPE">
											<option value="">请选择</option>
											  <option>普通货物</option>
											  <option>危险品</option>
											</select>
										</td>
 									</tr>
 									<tr>
 									<td><span class="span10">装卸标志：</span></td> 
										<td>
											<select name="LOAD_AND_UNLOAN_SIGN">
											<option value="">请选择</option>
											  <option>装</option>
											  <option>卸</option>
											   <option>装卸</option>
											</select>
										</td>
										<td><span class="span10">江船公司：</span></td>
										<td><input type="text" name="RIVER_BOAT_COMPANY" id="RIVER_BOAT_COMPANY"  maxlength="32" /></td>
 									</tr>
 									
 										<tr>
 									<td><span class="span10">开始时间：</span></td> 
									<td><input type="date" name="START_PRICE_TIME" id="START_PRICE_TIME"  maxlength="32" /></td>
										<td><span class="span10">结束时间：</span></td>
										<td><input type="date" name="END_PRICE_TIME" id="END_PRICE_TIME"  maxlength="32" /></td>
 									</tr>
 									<tr>
										
										<td>
										<a class="btn btn-xs btn-success">
											<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="add();">添加</i>
										</a>
									</td>
									</tr>
 								</table>
 							</fieldset>
						</form>
						<form action="internalFeeManage/list" method="post" name="internalFeeManageform" id="internalFeeManageform">
							<fieldset>
								<table style="margin-top:5px;"class="tab2">
									<tr>
										<td><span class="span10">港口名称：</span></td>
										<td><input type="text"   name="PROT_NAME" maxlength="32" /></td>
										<td><span class="span10">费用名称：</span></td>
										<td><input type="text"  name="FEE_NAME" maxlength="32" /></td>
										<td><span class="span10">结算单位：</span></td>
										<td><input type="text"   name="SETTLE_UNIT" maxlength="32" /></td>
										
									</tr>
									<tr>
										<td><span class="span10">单价：</span></td>
										<td><input type="text"   name="UNIT_PRICE" maxlength="32" /></td>
										<td><span class="span10">箱型：</span></td>
										<td>
											<select name="BOX_TYPE">
											<option value="">请选择</option>
											  <option>20DG</option>
											  <option>20FL</option>
											  <option>20FR</option>
											  <option>20GP</option>
											  <option>20OT</option>
											  <option>20RF</option>
											  <option>20TK</option>
											  <option>40DG</option>
											  <option>40FL</option>
											  <option>40FR</option>
											  <option>40GP</option>
											  <option>40HC</option>
											  <option>40NOR</option>
											  <option>40OT</option>
											  <option>40RF</option>
											  <option>40RH</option>
											  <option>40TK</option>
											  <option>45HC</option>
											  
											</select>
										</td>
										
									</tr>
									<tr>
									<td style="text-align: center;" colspan="10">
										<a class="btn btn-xs btn-success">
											<i class="ace-icon fa fa-pencil-square-o bigger-120" onclick="serch();">查询</i>
										</a>
									</td>
									</tr>
<!-- 									<tr> -->
<!-- 									<td style="text-align: left;" colspan="10"> -->
										
<!-- 									</td> -->
<!-- 									</tr> -->
								</table>
							</fieldset>
						</form>
						<fieldset>
						<a class="btn btn-mini btn-danger">
											<i class='ace-icon fa fa-trash-o bigger-120' onclick="deleteInfo();">批量删除</i>
											</a>
											<a  onclick="fromExcel();" title="从EXCEL导入"><i id="nav-search-icon" class="ace-icon fa fa-cloud-upload bigger-110 nav-search-icon blue">导入</i></a>
										
							<table id="simple-table" class="table table-striped table-bordered table-hover"  style="margin-top:5px;">
								<thead>
								<tr id="test1">
									<th class="center" style="width:35px;">
									<label class="pos-rel"><input type="checkbox" class="ace" id="zcheckbox" /><span class="lbl"></span></label>
									</th>
									
									<th class="center"id="option0">货物种类</th>
									<th class="center"id="option2"">箱型</th>
									<th class="center"id="option3">港口名称</th>
				 					<th class="center"id="option4">费用名称</th>
									<th class="center"id="option5">结算单位</th>
									<th class="center"id="option5">贸易类别</th>
									<th class="center"id="option5">单价</th>
									<th class="center"id="option5">运输条款</th>
									<th class="center"id="option5">空重标志</th>
									<th class="center"id="option5">装卸标志</th>
									<th class="center"id="option5">是否可用</th>
									<th class="center"id="option5">江船公司</th>
									<th class="center"id="option5">开始时间</th>
									<th class="center"id="option5">结束时间</th>
<!-- 									<th class="center"id="option5">修改</th> -->
									<th class="center"id="option5">删除</th>
									
								</tr>
							</thead>
							<tbody>
							<c:choose>
								<c:when test="${not empty internalFeeManage}">
									<c:forEach items="${internalFeeManage}" var="internalFeeManage" varStatus="vs">		
										<tr id="trId">
											<td class="dbclicktd" style="width: 30px;">
												<label><input type='checkbox' value="${internalFeeManage.ID }" id="ids"name="ids"class="ace"/><span class="lbl"></span></label>
												
											</td>
											<td class="dbclicktd"  id="td1">${internalFeeManage.GOODS_TYPE}</td>
											<td class='dbclicktd' id="td2">${internalFeeManage.BOX_TYPE}</td>
											<td class="dbclicktd" id="td3">${internalFeeManage.PROT_NAME}</td>
											<td class="dbclicktd"id="td4">${internalFeeManage.FEE_NAME}</td>
											<td class="dbclicktd"id="td4">${internalFeeManage.SETTLE_UNIT}</td>
											<td class="dbclicktd"id="td4">${internalFeeManage.TRADE_TYPE}</td>
											<td class="dbclicktd"id="td4">${internalFeeManage.UNIT_PRICE}</td>
											<td class="dbclicktd"id="td4">${internalFeeManage.TRANSPORT_CLAUSE}</td>
											<td class="dbclicktd"id="td4">${internalFeeManage.EMPTY_SIGN}</td>
											<td class="dbclicktd"id="td4">${internalFeeManage.LOAD_AND_UNLOAN_SIGN}</td>
											<td class="center"><c:choose><c:when test="${internalFeeManage.ENABLE==1}">是</c:when>
												<c:otherwise>否</c:otherwise></c:choose></td>
											<td class="dbclicktd"id="td4">${internalFeeManage.RIVER_BOAT_COMPANY}</td>
											<td class="dbclicktd"id="td4"><fmt:formatDate value="${internalFeeManage.START_PRICE_TIME }" pattern="yyyy-MM-dd" /></td>
											
											<td class="dbclicktd"id="td4"><fmt:formatDate value="${internalFeeManage.END_PRICE_TIME}" pattern="yyyy-MM-dd" /></td>
											
<!-- 											<td class="center"> -->
<!-- 											<div class="hidden-sm hidden-xs btn-group"> -->
<%-- 												<a class="btn btn-xs btn-success" onclick="edit('${internalFeeManage.ID}');"> --%>
<!-- 													<i class="ace-icon fa fa-pencil-square-o bigger-120">修改</i> -->
<!-- 												</a> -->
<!-- 											</div> -->
<!-- 											</td> -->
											<td class="center">
											<div class="hidden-sm hidden-xs btn-group">
												<a class="btn btn-mini btn-danger"onclick="deleteInfot('${internalFeeManage.ID}');">
													<i class="ace-icon fa fa-trash-o bigger-120">删除</i>
												</a>
											</div>
											</td>		
										</tr>
										
									
									</c:forEach>
<!-- 									<div class="hidden-sm hidden-xs btn-group"> -->
<%-- 											<a class="btn btn-xs btn-success" title="编辑" onclick="editUser('${user.USER_ID}');"> --%>
<!-- 														<i class="ace-icon fa fa-pencil-square-o bigger-120" title="编辑"></i> -->
<!-- 													</a> -->
<!-- 												</div> -->
								</c:when>
							</c:choose>
							</tbody>
							</table>
							<div class="page-header position-relative">
							<table style="width:100%;">
							<tr>
								<td style="vertical-align:top;"><div class="pagination" style="float: right;padding-top: 0px;margin-top: 0px;">${page.pageStr}</div></td>
							</tr>
						</table>
						</div>
						</fieldset>
					</div>
				</div>
			</div>
		</div>
	</div>
	<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
			<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
		</a>
</div>
<%@ include file="../../../system/index/foot.jsp"%>
	<!-- ace scripts -->
	<script src="static/ace/js/ace/ace.js"></script>
</body>
<script type="text/javascript">
function add(){

	 $.ajax({
         type: "POST",
         url: '<%=basePath%>internalFeeManage/saveOrUpdateInternalFeeManage',
         data: $("#internalFeeManage").serialize(),
         dataType: 'json',
         cache: false,
         success: function (data) {
        	 alert("保存成功")
        	 window.location.reload();
        	 
         }
     });
}
function deleteInfot(ID){
	$.ajax({
        type: "POST",
        url: '<%=basePath%>internalFeeManage/deleteInternalFeeManage?ID='+ID,
        dataType: 'json',
        cache: false,
        success: function (data) {
       	 window.location.reload();
       	 
        }
    });
}
function deleteInfo(){
	var trList = [];
	var $simpleTabletr = $("#simple-table tbody tr");
	var list = {}
	for(var i=0,len=$simpleTabletr.length;i<len;i++){
		
		var objTr = $simpleTabletr[i];
		
		var flag = $(objTr).find("td").first().find("label").find("#ids")[0].checked;
		if(flag){
			trList.push(objTr);
		}
	}
	//传到后台的data json格式
	var data = [];
	 for(var i=0,size=trList.length;i<size;i++){
		var $tds = $(trList[i]).find("td");
		//id
		var id = $($tds[0]).find("label").find("input[name='ids']")[0].value;
		var item = {};
		item.ID = id.trim();
		data.push(item)
	}
	 var dataStr = JSON.stringify(data);
	 $.ajax({
         type: "POST",
         url: '<%=basePath%>internalFeeManage/deleteInternalFeeManageAll',
         data: {dataJsonStr:dataStr},
         dataType: 'json',
         //beforeSend: validateData,
         cache: false,
         success: function (data) {
        	 window.location.reload();
        	 
         }
     });
}
$(function() {
	//复选框全选控制
	var active_class = 'active';
	$('#simple-table > thead > tr > th input[type=checkbox]').eq(0).on('click', function(){
		var th_checked = this.checked;//checkbox inside "TH" table header
		$(this).closest('table').find('tbody > tr').each(function(){
			var row = this;
			if(th_checked) $(row).addClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', true);
			else $(row).removeClass(active_class).find('input[type=checkbox]').eq(0).prop('checked', false);
		});
	});
});
function serch(){
	top.jzts();
	$("#internalFeeManageform").submit();
	}
	
	
//打开上传excel页面
function fromExcel(){
	 top.jzts();
	 var diag = new top.Dialog();
	 diag.Drag=true;
	 diag.Title ="EXCEL 导入到数据库";
	 diag.URL = '<%=basePath%>internalFeeManage/goUploadExcel';
	 diag.Width = 300;
	 diag.Height = 150;
	 diag.CancelEvent = function(){ //关闭事件
		
			 diag.close();
		     	window.location.reload();
		
		 
	 };
	 diag.show();
}

</script>
</html>